<!-- D:/project/app/ydz-app-uniapp/static/images/mine -->
<template>
	<view class="pagebody" :style="{ height: maxHeight }">
		<view class="topbox">
			<view class=" align-center justify-between">
				<view class=" flex-row align-center">
					<image @click="backpage" src="@/static/images/login/leftjt.png" alt=""
						style="width: 48rpx;height: 48rpx;"></image>
				</view>
				<view class="color303b39 fz40 fwbold">
					设置
				</view>
				<view class="">
				</view>
			</view>
		</view>
		<view class="bgfff" style="padding: 0 24rpx;">
			<view class="justify-between align-center" style="border-bottom: 1rpx solid #D7DDDC;height: 112rpx;">
				<view class="fz30" style="color: #576260;">
					当前版本
				</view>
				<view class="color303b39 fz32">
					{{version}}
				</view>
			</view>
			<view @click="toyspage(2)" class="justify-between align-center"
				style="border-bottom: 1rpx solid #D7DDDC;height: 112rpx;">
				<view class="fz30" style="color: #576260;">
					隐私政策
				</view>
				<view class="fz32" style="color: #B8C3C1;">
					＞
				</view>
			</view>
			<view @click="toyspage(1)" class="justify-between align-center" style="height: 112rpx;">
				<view class="fz30" style="color: #576260;">
					用户协议
				</view>
				<view class="fz32" style="color: #B8C3C1;">
					＞
				</view>
			</view>
		</view>
		<view class="bgfff align-center justify-center fz36" @click="exitshow = true"
			style="height: 116rpx;color: #00D9B2;position: fixed;width: 100%;bottom: 0;">
			退出当前账号
		</view>
		<u-modal v-model="exitshow" :show-cancel-button="true" :confirm-text="'确认'" @confirm="exit" @cancel="noexit"
			:cancel-text="'取消'" content="确定注销并退出系统吗？"></u-modal>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {
		type
	} from 'os';
	import FixedFoot from '../../layouts/fixedfoot.vue';
	import {
		getVersion
	} from '@/api/api.js'
	import config from '@/config'
	export default {
		components: {
			FixedFoot
		},
		onLoad(options) {
			// 获得屏幕最大高度
			let systemInfo = uni.getSystemInfoSync();
			this.maxHeight = systemInfo.windowHeight + "px";
		},


		data() {
			return {
				version:'',
				placeholderStyle: "color:#7E8987;font-size:32rpx",
				maxHeight: '',
				exitshow: false,
			}
		},
		watch: {},
		created() {
			getVersion().then(res=>{
				this.version = res.data.version
			})

		},
		methods: {

			toyspage(typeid) {
				uni.navigateTo({
					url: '/pages/mine/privacy/index?typeid=' + typeid
				});
			},
			exit() {
				this.$store.dispatch('LogOut').then(() => {
					this.$tab.reLaunch('/pages/login/otherlogin')
				})
			},
			noexit() {
				this.exitshow = false
			},


			change(e) {
				console.log(e)
				this.caseform.caseTime = e.result
			},
			getTypelist() {
				getDicts('violation_type').then(res => {
					this.reportlist = res.data
				})

			},
			submit() {
				addCase(this.caseform).then(res => {
					this.$refs.uToast.show({
						title: '添加病例成功',
						type: 'success',
					})
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						});
					}, 1000)

				})
			},
			toadd() {
				console.log(this.caseform)
			},
			backpage() {
				uni.navigateBack({
					delta: 1,
				});
			},
			uploadfile() {
				uni.chooseImage({
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						const uploadTask = uni.uploadFile({
							url: 'https://www.example.com/upload', //仅为示例，非真实的接口地址
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								'user': 'test'
							},
							success: (uploadFileRes) => {
								console.log(uploadFileRes.data);
							}
						});

						uploadTask.onProgressUpdate((res) => {
							console.log('上传进度' + res.progress);
							console.log('已经上传的数据长度' + res.totalBytesSent);
							console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);

							// 测试条件，取消上传任务。
							if (res.progress > 50) {
								uploadTask.abort();
							}
						});
					}
				});
			},

			removelist(index, lists, name) {
				this.caseform.attachFiles.splice(index, 1)
			},
			uploadlist(data, index, lists, name) {
				let fileobj = {
					url: data.url,
					fileName: data.fileName
				}
				this.caseform.attachFiles.push(fileobj)
			},


		},

	}
</script>

<style lang="scss" scoped>
	::v-deep .is-input-border {
		border: none;
	}

	::v-deep .uni-easyinput__content {
		background: transparent !important;
	}

	::v-deep .uni-input-input {
		font-size: 32rpx;
	}

	.pagebody {
		padding-bottom: 136rpx;
		background: #F0F6F5;

		.topbox {
			height: 128rpx;
			background: #FFFFFF;
			padding: 20rpx 24rpx;
		}

		.inputbox {
			height: 96rpx;
			border-bottom: 1px solid #D7DDDC;
		}

		.istype {
			background: #E5FBF7 !important;
			color: #00977C;
			font-weight: bold;
		}

		.addcase {

			margin-top: 179rpx;
			height: 98rpx;
			background: #00D9B2;
			border-radius: 98rpx;
			color: #FFFFFF;
			font-size: 36rpx;
		}


	}
</style>